package br.fmapn.process.entities;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;

import br.fmapn.reporter.util.MappingEffiencienceReport;

/**
 * Entity class representing a BusinessOperation 
 * @author Fellipe
 */

@NamedQueries({
		@NamedQuery(name="findAllBusinessOperation", 
				query="SELECT bo FROM BusinessOperation bo"),
		@NamedQuery(name="findBusinessOperarionByBusinessProcess", 
				query="SELECT bo FROM BusinessOperation bo WHERE bo.businessProcess.id = :idBP")
})

@Entity
public class BusinessOperation implements Serializable {
	private static final long serialVersionUID = -3791758403902478316L;
	private int id;
	private String name;
	private BusinessProcess businessProcess = new BusinessProcess();
	private MappingEffiencienceReport mappingEffiencienceReport;
	
	public BusinessOperation() {
		super();
	}
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@ManyToOne(fetch = FetchType.EAGER)
	public BusinessProcess getBusinessProcess() {
		return businessProcess;
	}
	
	public void setBusinessProcess(BusinessProcess businessProcess) {
		this.businessProcess = businessProcess;
	}

	public void setMappingEffiencienceReport(MappingEffiencienceReport mappingEffiencienceReport) {
		this.mappingEffiencienceReport = mappingEffiencienceReport;
	}

	@Transient
	public MappingEffiencienceReport getMappingEffiencienceReport() {
		return mappingEffiencienceReport;
	}
}
